package com.jiukuaidao.zhulin.module.address.presenter;

import com.jiukuaidao.library.net.MyRetroCallBack;
import com.jiukuaidao.zhulin.api.ApiDeleteAddress;
import com.jiukuaidao.zhulin.data.TasksRepository;
import com.jiukuaidao.zhulin.module.address.contract.DeleteAddressContract;

/**
 * Author : PaiTaSuo
 * Date : 2016/6/16
 * Description :
 */
public class DeleteAddressPresenter implements DeleteAddressContract.Presenter {
    protected TasksRepository mRepository;
    protected DeleteAddressContract.View mView;

    public DeleteAddressPresenter(TasksRepository repository, DeleteAddressContract.View view) {
        this.mRepository = repository;
        this.mView = view;
    }

    @Override
    public void loadData() {
        mRepository.loadData(new ApiDeleteAddress(mView.getAddressId(), new MyRetroCallBack() {
            @Override
            public void onSuccess(Object result, String errorCode, String msg) {
                mView.toast(msg);
            }

            @Override
            public void onFail(Object result, String errorCode, String msg) {
                mView.toast(msg);
            }

            @Override
            public void onError(Throwable t, int resCode, String msg) {
                mView.toast(msg);
            }
        }));
    }
}
